/*
   Copyright (c) 2023 李伟国
   learner-platform is licensed under Mulan PSL v2.
   You can use this software according to the terms and conditions of the Mulan PSL v2.
   You may obtain a copy of Mulan PSL v2 at:
               http://license.coscl.org.cn/MulanPSL2
   THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.  
   See the Mulan PSL v2 for more details. 
*/

package cn.platform.mapper;

import cn.platform.entity.RolePermission;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface RolePermissionMapper extends BaseMapper<RolePermission> {
    List<RolePermission> selectByRoleId(Long roleId);
    List<Long> selectPermissionIdByRoleId(Long roleId);
    int deleteByPermission(@Param("roleId") Long roleId, @Param("permissionId") Long permissionId);
    @Insert("insert into learner_role_permission (permission_id, role_id)\n" +
            "        values (#{permissionId}, #{roleId})")
    int insertByRoleIdPermissionId(@Param("roleId") Long roleId, @Param("permissionId") Long permissionId);
}
